//
//  AppDelegate+SDKSet.m
//  tesDemo02
//
//  Created by 拓客营 on 2022/3/23.
//

#import "AppDelegate+SDKSet.h"

NSString *const kAFNetworkReachabilityNotification = @"kAFNetworkReachabilityNotification";

@implementation AppDelegate (SDKSet)

- (void)configSDK {
    
    [self setIQKeyboard];
    [self startNetworkMonitor];
}



- (void)setIQKeyboard{
    
    [IQKeyboardManager sharedManager].enable = YES;
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
    [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"完成";
}

- (void)startNetworkMonitor{
    
    if (YTClient.shared.isLogin) {
        [APIManager manager].token = YTClient.shared.user.token;
    }
    
    [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        
        [NSNotificationCenter.defaultCenter postNotificationName:kAFNetworkReachabilityNotification object:nil userInfo:@{@"status":@(status)}];
        
    }];
    
    [[AFNetworkReachabilityManager sharedManager] startMonitoring];
}

@end
